package com.lfy.modules.blog.domain.dto.user;

import com.lfy.modules.blog.domain.group.SaveGroup;
import com.lfy.modules.blog.domain.group.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

@Data
public class UserDTO {
    @NotNull(message = "id不能为空", groups = {UpdateGroup.class})
    @Null(message = "id必须为空", groups = {SaveGroup.class})
    private Long id;
    @NotBlank(message = "用户名不能为空", groups = {SaveGroup.class})
    @Email(message = "用户名格式不正确", groups = {SaveGroup.class, UpdateGroup.class})
    private String username;
    @NotBlank(message = "密码不能为空",groups = {SaveGroup.class})
    @Length(min = 6, max = 16, message = "密码长度必须在6-16之间",groups = {SaveGroup.class, UpdateGroup.class})
    private String password;
    @NotBlank(message = "确认密码不能为空",groups = {SaveGroup.class})
    @Length(min = 6, max = 16, message = "确认密码长度必须在6-16之间",groups = {SaveGroup.class, UpdateGroup.class})
    private String rePassword;
    @NotNull(message = "角色不能为空",groups = {SaveGroup.class})
    private Long roleId;
    @NotNull(message = "是否冻结不能为空",groups = {SaveGroup.class})
    private Integer freeze;
    @NotBlank(message = "名字不能为空",groups = {SaveGroup.class})
    @Length(min = 1, max = 10, message = "名字长度必须在1-10之间",groups = {SaveGroup.class, UpdateGroup.class})
    private String name;
    @NotBlank(message = "路径不能为空",groups = {SaveGroup.class})
    @Length(min = 1, max = 10, message = "路径长度必须在1-10之间",groups = {SaveGroup.class, UpdateGroup.class})
    private String url;
}
